// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import ElementUI from 'element-ui'
import DevicePixelRatio from "./devicePixelRatio";
import store from "./store/store"

Vue.config.productionTip = false
Vue.use(ElementUI)
/* eslint-disable no-new */

router.beforeEach((to,from,next)=>{
  if (to.path === '/operating' || to.path === '/treatment') {
    const token = sessionStorage.getItem('token')
    if(!token) return next('/login')
  }
  // else if (to.path === '/failure'){
  //   const filecode = sessionStorage.getItem('failcode')
  //   if (!filecode) return next('/')
  //   return next()
  // }else if(to.path === '/success'){
  //   const tokenStr = sessionStorage.getItem('token');//获取token值
  //   if (!tokenStr) return next('/')
  // }
  next()
})
new Vue({
  el: '#app',
  router,
  store,
  components: { App },
  template: '<App/>',
  created() {
    new DevicePixelRatio().init()
  }
})
